<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 声明map
        let m = new Map();

        // 添加元素 set
        m.set('name','小明');
        console.log(m);

        let key = {
            school:'清华'
        };
        m.set(key,['北京','上海'])//key是对象，值是数组
        console.log(m);

        // 获取元素个数 size
        console.log(m.size);//2
        // 删除元素 delete
        // m.delete('name');
        // console.log(m);
        // 获取 get
        console.log(m.get('name'));

        // 清空 clear
        // m.clear();

        // 遍历
        for (let v of m) {
            console.log(v);
        }
    </script>
</body>
</html>